#include <stdio.h>
#include <windows.h>
 
void MouseEventProc(MOUSE_EVENT_RECORD); 
 
 
int main(void) 
{ 
    HANDLE hStdin; 
    DWORD cNumRead, fdwMode, fdwSaveOldMode, i; 
    INPUT_RECORD irInBuf[128]; 
  
    // Get the standard input handle. 
  
    hStdin = GetStdHandle(STD_INPUT_HANDLE); 
  
    // Enable the window and mouse input events. 
  
    fdwMode = ENABLE_MOUSE_INPUT; 
    SetConsoleMode(hStdin, fdwMode); 
  
    // Loop to read and handle the input events. 
  
    while (1) 
    { 
  
        // Wait for the events. 
  
        ReadConsoleInput( 
                hStdin,      // input buffer handle 
                irInBuf,     // buffer to read into 
                128,         // size of read buffer 
                &cNumRead);  // number of records read  
  
        // Dispatch the events to the appropriate handler. 
  
        for (i = 0; i < cNumRead; i++) 
        {
            switch(irInBuf[i].EventType) 
            { 
                case MOUSE_EVENT: // mouse input 
                    MouseEventProc(irInBuf[i].Event.MouseEvent); 
                    break; 
            } 
        }
    } 
  
    return 0; 
} 
 
VOID MouseEventProc(MOUSE_EVENT_RECORD ir)
{
	if(ir.dwEventFlags == MOUSEEVENTF_LEFTDOWN)
	{
		int x = GetSystemMetrics(SM_CXFULLSCREEN)/2;
		int y = GetSystemMetrics(SM_CYFULLSCREEN)/2;
		SetCursorPos(x, y);
	}
}
 

 